package com.moonbird.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moonbird.springboot.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 用户Mapper接口
 * @author hpl
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT * FROM user_info WHERE username = #{username} AND password = #{password}")
    User findByUsernameAndPassword(String username, String password);

    @Select("SELECT COUNT(*) FROM user_info WHERE username = #{username}")
    boolean findByUsername(String username);

    @Update("UPDATE user_info SET password = #{password} WHERE username = #{username}")
    int updatePassword(String password, String username);
}
